/**
 * 
 */
package org.dragonfire.dasm.directives;

import java.util.ArrayList;

import org.dragonfire.dasm.Command;
import org.dragonfire.dasm.Listing;
import org.dragonfire.dasm.DirectiveManager.Directive;

/**
 * Sets a command-line parameter<br />
 * <br />
 * Format:<br />
 * <code>#SETPARAM <i>&lt;name&gt;</i>,<i>&lt;value&gt;</i></code><br />
 * <br />
 * Parameters:<br />
 * <table>
 * <tr>
 * <td><code>name</code></td>
 * <td>The name of the parameter to modify</td>
 * </tr>
 * <tr>
 * <td><code>value</code></td>
 * <td>The value to change the parameter to</td>
 * </tr>
 * </table><br />
 * Errors:<br />
 * <table>
 * <tr>
 * <td><code>ERROR_NOT_ENOUGH_ARGS</code></td>
 * <td>Thrown if <code>name</code> or <code>value</code> are missing</td>
 * </tr>
 * <tr>
 * <td><code>ERROR_STRING_REQUIRED</code></td>
 * <td>Thrown if <code>name</code> or <code>value</code> are not strings</td>
 * </tr>
 * </table>
 * 
 * @author Darth Android
 * @version 2.0
 * @see org.dragonfire.dasm.DASM#setParam(String, String)
 */
public class Setparam extends Directive {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ArrayList<Listing> pass1(Command c) {
		// extract parameters
		String param = evalString(c.getParam(0));
		String value = evalString(c.getParam(1));
		// set the parameter
		getCompiler().setParam(param, value);
		return null;
	}
}
